Ext.define('demo.view.user',{
	extend:'Ext.panel.Panel',
	alias:'widget.duser',
	layout:'border',
	items:[
		{
			xtype:'gridpanel',
			region:'west',
			collapisble: true,
			flex:1,
			store: 'userStore', 
            columns: [
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'username',
                    text: '姓名'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'age',
                    text: '年龄'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'sex',
                    text: '性别'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'height',
                    text: '身高'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'weight',
                    text: '体重'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'birth',
                    text: '出生日期',
                    renderer:function(value, cellmeta, record){
						return Ext.util.Format.date(record.data.birth,'Y-m-d');
					}
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'status',
                    text: '政治面貌'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'address',
                    text: '通讯地址'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'contact',
                    text: '联系方式'
                }                           
            ],
  			 tbar:[
					{xtype:'button',text:'添加用户',action:'addUserInfo',id:'addUser'},
					{xtype:'button',text:'保存用户',action:'saveUserInfo',disabled:true,id:'saveUser'},
					{xtype:'button',text:'编辑用户',action:'editUserInfo',disabled:true,id:'editUser'},
					{xtype:'button',text:'删除用户',action:'deleteUserInfo',disabled:true,id:'deleteUser'}
				],
            
		},
		{
			xtype:'panel',
			region: 'center',
			flex:2,
			title:'用户信息管理',	
			layout:'fit',
			items:[
				{
					xtype:'form',
					layout: 'anchor',
					border:0,
					id:'userInfo',
				    defaults:{
						margin:'5 30 0 5',
						anchor: '100%',
						labelWidth:60,
						readOnly: true
					},
				    items:[
					   {
						xtype: 'textfield',
	            		name : 'username',
	            		fieldLabel: '姓名',
	            		allowBlank:false,
					  },
					   {
                    		xtype:'numberfield',
                    		name : 'age',
                    		fieldLabel: '年龄',
                    		minValue:1,
                    		maxValue:150,
                    		blankText:'请输入年龄',
                    		//allowBlank:false,
                    		allowDecimals:false, //不能输入小数
                    		hideTrigger:true     //隐藏微调按钮
	                   },
					  {
                		xtype:'radiogroup',								
						items:[
							{
								xtype:'radiofield',
								boxLabel:'男',
								inputValue:'男',  //向后台提交的数据
								name:'sex',
								checked:true, //默认选择
								readOnly: true
							},
							{
								xtype:'radiofield',
								boxLabel:'女',
								inputValue:'女',
								name:'sex',
								readOnly: true
							}
							],
							columns:[50,75,75],
							name:'sex',
							fieldLabel:'性别',
	                    },					    
	                    {
                    		xtype:'numberfield',
                    		name : 'height',
                    		fieldLabel: '身高',
                    		minValue:1,
                    		maxValue:300,
                    		blankText:'请输入身高',
                    		//allowBlank:false,
                    		allowDecimals:false, //不能输入小数
                    		hideTrigger:true     //隐藏微调按钮
	                     },
					   {
                    		xtype:'numberfield',
                    		name : 'weight',
                    		fieldLabel: '体重',
                    		blankText:'请输入体重',
                    		//allowBlank:false,
                    		allowDecimals:false, //不能输入小数
                    		hideTrigger:true     //隐藏微调按钮
	                    },					  
					    {
                    		xtype:'datefield',
                    		name:'birth',
                    		format:'Y-m-d',
                    		editable:false,
                    		fieldLabel:'出生日期',	  
	                    },
					    {
                    		xtype: 'combobox',
	                        name : 'status',
	                        fieldLabel: '政治面貌',
	                        store:new Ext.data.ArrayStore({
	                        	fields: ['id', 'name'],
	                        	data: [[1, '党员'], [2, '团员'], [3, '群众']]
	                        }),
	                        queryMode:'local',
	                        valueField:'name',
	                        displayField:'name',

	                    },
						{
							 xtype: 'textfield',
	        				 name : 'address',
	        				 fieldLabel: '通讯地址',
						},
					     {
                    		xtype: 'textfield',
            				name : 'contact',
            				fieldLabel: '联系方式'
	                     },

				    ],
				    

				}
				
			]
		}
	]
	
})
